Skip to content

test: use gotoChannel when possible#41084

Merged
dionisio-bot[bot] merged 1 commit into
developfrom
test-quote-attachment-flaky
Jun 29, 2026
Merged

test: use gotoChannel when possible#41084
dionisio-bot[bot] merged 1 commit into
developfrom
test-quote-attachment-flaky

Conversation

@sampaiodiego

@sampaiodiego sampaiodiego commented Jun 25, 2026

Copy link
Copy Markdown
Member

Proposed changes (including videos or screenshots)

Using gotoChannel is more reliable and can fix some flaky tests out there.

Issue(s)

Steps to test or reproduce

Further comments

Review in cubic

Summary by CodeRabbit

  • Documentation

    • Updated end-to-end testing guidance with a recommended, more reliable way to open a known room.
    • Added clearer do’s and don’ts for navigating to rooms in test flows.
  • Tests

    • Standardized several automated tests to use the same room-navigation approach.
  • Bug Fixes

    • Improved test stability by avoiding a navigation pattern that could race with loading and cause hangs.

@dionisio-bot

dionisio-bot Bot commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

Looks like this PR is ready to merge! 🎉
If you have any trouble, please check the PR guidelines

@changeset-bot

changeset-bot Bot commented Jun 25, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 3cfb26e

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@coderabbitai

coderabbitai Bot commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 437d68e5-391c-446d-9fcf-3239557ddb58

📥 Commits

Reviewing files that changed from the base of the PR and between 64af832 and 3cfb26e.

📒 Files selected for processing (6)
  • apps/meteor/tests/e2e/README.md
  • apps/meteor/tests/e2e/embedded-layout.spec.ts
  • apps/meteor/tests/e2e/file-upload.spec.ts
  • apps/meteor/tests/e2e/image-upload.spec.ts
  • apps/meteor/tests/e2e/quote-attachment.spec.ts
  • apps/meteor/tests/e2e/quote-messages.spec.ts
📜 Recent review details
⏰ Context from checks skipped due to timeout. (3)
  • GitHub Check: cubic · AI code reviewer
  • GitHub Check: Hacktron Security Check
  • GitHub Check: 🔨 Test Federation Matrix
🧰 Additional context used
📓 Path-based instructions (4)
**/*.{ts,tsx,js}

📄 CodeRabbit inference engine (.cursor/rules/playwright.mdc)

**/*.{ts,tsx,js}: Write concise, technical TypeScript/JavaScript with accurate typing in Playwright tests
Avoid code comments in the implementation

Files:

  • apps/meteor/tests/e2e/image-upload.spec.ts
  • apps/meteor/tests/e2e/quote-attachment.spec.ts
  • apps/meteor/tests/e2e/quote-messages.spec.ts
  • apps/meteor/tests/e2e/file-upload.spec.ts
  • apps/meteor/tests/e2e/embedded-layout.spec.ts
**/*.spec.ts

📄 CodeRabbit inference engine (.cursor/rules/playwright.mdc)

**/*.spec.ts: Use descriptive test names that clearly communicate expected behavior in Playwright tests
Use .spec.ts extension for test files (e.g., login.spec.ts)

Files:

  • apps/meteor/tests/e2e/image-upload.spec.ts
  • apps/meteor/tests/e2e/quote-attachment.spec.ts
  • apps/meteor/tests/e2e/quote-messages.spec.ts
  • apps/meteor/tests/e2e/file-upload.spec.ts
  • apps/meteor/tests/e2e/embedded-layout.spec.ts
apps/meteor/tests/e2e/**/*.spec.ts

📄 CodeRabbit inference engine (.cursor/rules/playwright.mdc)

apps/meteor/tests/e2e/**/*.spec.ts: All test files must be created in apps/meteor/tests/e2e/ directory
Avoid using page.locator() in Playwright tests - always prefer semantic locators such as page.getByRole(), page.getByLabel(), page.getByText(), or page.getByTitle()
Use test.beforeAll() and test.afterAll() for setup/teardown in Playwright tests
Use test.step() for complex test scenarios to improve organization in Playwright tests
Group related tests in the same file
Utilize Playwright fixtures (test, page, expect) for consistency in test files
Prefer web-first assertions (toBeVisible, toHaveText, etc.) in Playwright tests
Use expect matchers for assertions (toEqual, toContain, toBeTruthy, toHaveLength, etc.) instead of assert statements in Playwright tests
Use page.waitFor() with specific conditions instead of hardcoded timeouts in Playwright tests
Implement proper wait strategies for dynamic content in Playwright tests
Maintain test isolation between test cases in Playwright tests
Ensure clean state for each test execution in Playwright tests
Ensure tests run reliably in parallel without shared state conflicts

Files:

  • apps/meteor/tests/e2e/image-upload.spec.ts
  • apps/meteor/tests/e2e/quote-attachment.spec.ts
  • apps/meteor/tests/e2e/quote-messages.spec.ts
  • apps/meteor/tests/e2e/file-upload.spec.ts
  • apps/meteor/tests/e2e/embedded-layout.spec.ts
apps/meteor/tests/e2e/**/*.{ts,spec.ts}

📄 CodeRabbit inference engine (.cursor/rules/playwright.mdc)

apps/meteor/tests/e2e/**/*.{ts,spec.ts}: Store commonly used locators in variables/constants for reuse
Follow Page Object Model pattern consistently in Playwright tests

Files:

  • apps/meteor/tests/e2e/image-upload.spec.ts
  • apps/meteor/tests/e2e/quote-attachment.spec.ts
  • apps/meteor/tests/e2e/quote-messages.spec.ts
  • apps/meteor/tests/e2e/file-upload.spec.ts
  • apps/meteor/tests/e2e/embedded-layout.spec.ts
🧠 Learnings (6)
📚 Learning: 2026-02-24T19:22:48.358Z
Learnt from: juliajforesti
Repo: RocketChat/Rocket.Chat PR: 38493
File: apps/meteor/tests/e2e/omnichannel/omnichannel-send-pdf-transcript.spec.ts:66-67
Timestamp: 2026-02-24T19:22:48.358Z
Learning: In Playwright end-to-end tests (e.g., under apps/meteor/tests/e2e/...), prefer locating elements by translated text (getByText) and ARIA roles (getByRole) over data-qa attributes. If translation values change, update the corresponding test locators accordingly. Never use data-qa locators. This guideline applies to all Playwright e2e test specs in the repository and helps keep tests robust to UI text changes and accessible semantics.

Applied to files:

  • apps/meteor/tests/e2e/image-upload.spec.ts
  • apps/meteor/tests/e2e/quote-attachment.spec.ts
  • apps/meteor/tests/e2e/quote-messages.spec.ts
  • apps/meteor/tests/e2e/file-upload.spec.ts
  • apps/meteor/tests/e2e/embedded-layout.spec.ts
📚 Learning: 2026-02-24T19:39:42.247Z
Learnt from: juliajforesti
Repo: RocketChat/Rocket.Chat PR: 38493
File: apps/meteor/tests/e2e/page-objects/fragments/message.ts:7-7
Timestamp: 2026-02-24T19:39:42.247Z
Learning: In RocketChat e2e tests, avoid using data-qa attributes to locate elements. Prefer semantic locators such as getByRole, getByLabel, getByText, getByTitle and ARIA-based selectors. Apply this rule to all TypeScript files under apps/meteor/tests/e2e to improve test reliability, accessibility, and maintainability.

Applied to files:

  • apps/meteor/tests/e2e/image-upload.spec.ts
  • apps/meteor/tests/e2e/quote-attachment.spec.ts
  • apps/meteor/tests/e2e/quote-messages.spec.ts
  • apps/meteor/tests/e2e/file-upload.spec.ts
  • apps/meteor/tests/e2e/embedded-layout.spec.ts
📚 Learning: 2026-02-26T19:25:44.063Z
Learnt from: gabriellsh
Repo: RocketChat/Rocket.Chat PR: 38778
File: packages/ui-voip/src/providers/useMediaSession.ts:192-192
Timestamp: 2026-02-26T19:25:44.063Z
Learning: In the Rocket.Chat repository, do not reference Biome lint rules in code review feedback. Biome is not used even if biome.json exists; only reference Biome rules if there is explicit, project-wide usage documented. For TypeScript files, review lint implications without Biome guidance unless the project enables Biome rules.

Applied to files:

  • apps/meteor/tests/e2e/image-upload.spec.ts
  • apps/meteor/tests/e2e/quote-attachment.spec.ts
  • apps/meteor/tests/e2e/quote-messages.spec.ts
  • apps/meteor/tests/e2e/file-upload.spec.ts
  • apps/meteor/tests/e2e/embedded-layout.spec.ts
📚 Learning: 2026-02-26T19:25:44.063Z
Learnt from: gabriellsh
Repo: RocketChat/Rocket.Chat PR: 38778
File: packages/ui-voip/src/providers/useMediaSession.ts:192-192
Timestamp: 2026-02-26T19:25:44.063Z
Learning: In this repository (RocketChat/Rocket.Chat), Biome lint rules are not used even if a biome.json exists. When reviewing TypeScript files (e.g., packages/ui-voip/src/providers/useMediaSession.ts), ensure lint suggestions do not reference Biome-specific rules. Rely on general ESLint/TypeScript lint rules and project conventions instead.

Applied to files:

  • apps/meteor/tests/e2e/image-upload.spec.ts
  • apps/meteor/tests/e2e/quote-attachment.spec.ts
  • apps/meteor/tests/e2e/quote-messages.spec.ts
  • apps/meteor/tests/e2e/file-upload.spec.ts
  • apps/meteor/tests/e2e/embedded-layout.spec.ts
📚 Learning: 2026-03-06T18:10:15.268Z
Learnt from: tassoevan
Repo: RocketChat/Rocket.Chat PR: 39397
File: packages/gazzodown/src/code/CodeBlock.spec.tsx:47-68
Timestamp: 2026-03-06T18:10:15.268Z
Learning: In tests (especially those using testing-library/dom/jsdom) for Rocket.Chat components, the HTML <code> element has an implicit ARIA role of 'code'. Therefore, screen.getByRole('code') or screen.findByRole('code') will locate <code> elements even without a role attribute. Do not flag findByRole('code') as invalid in reviews; prefer using the implicit role instead of adding role="code" unless necessary for accessibility.

Applied to files:

  • apps/meteor/tests/e2e/image-upload.spec.ts
  • apps/meteor/tests/e2e/quote-attachment.spec.ts
  • apps/meteor/tests/e2e/quote-messages.spec.ts
  • apps/meteor/tests/e2e/file-upload.spec.ts
  • apps/meteor/tests/e2e/embedded-layout.spec.ts
📚 Learning: 2026-05-06T12:21:44.083Z
Learnt from: juliajforesti
Repo: RocketChat/Rocket.Chat PR: 40256
File: apps/meteor/client/components/CreateDiscussion/CreateDiscussion.tsx:121-149
Timestamp: 2026-05-06T12:21:44.083Z
Learning: Field wrappers in rocket.chat/fuselage-forms (Field, FieldLabel, FieldRow, FieldError, FieldHint) auto-create htmlFor/id associations, aria-describedby, and role="alert" for errors. Do not manually set htmlFor, id, aria-describedby, or role attributes when using these wrappers. This automatic wiring does not apply to plain rocket.chat/fuselage components, which require explicit ID wiring per the accessibility docs. In code reviews, prefer using fuselage-forms wrappers for form fields and verify there is no unnecessary manual ID/aria wiring in files that use these wrappers. If a component uses plain fuselage components, ensure proper id wiring as per docs.

Applied to files:

  • apps/meteor/tests/e2e/image-upload.spec.ts
  • apps/meteor/tests/e2e/quote-attachment.spec.ts
  • apps/meteor/tests/e2e/quote-messages.spec.ts
  • apps/meteor/tests/e2e/file-upload.spec.ts
  • apps/meteor/tests/e2e/embedded-layout.spec.ts
🔇 Additional comments (6)
apps/meteor/tests/e2e/README.md (1)

246-265: LGTM!

Also applies to: 319-319, 354-354

apps/meteor/tests/e2e/embedded-layout.spec.ts (1)

34-34: 🎯 Functional Correctness

gotoChannel already receives the room name here. createTargetChannel() returns a channel name, and HomeChannel.gotoChannel() builds /channel/${name}, so these calls are correct.

			> Likely an incorrect or invalid review comment.
apps/meteor/tests/e2e/file-upload.spec.ts (1)

27-27: LGTM!

Also applies to: 134-134, 237-237

apps/meteor/tests/e2e/image-upload.spec.ts (1)

21-22: LGTM!

apps/meteor/tests/e2e/quote-attachment.spec.ts (1)

21-21: LGTM!

apps/meteor/tests/e2e/quote-messages.spec.ts (1)

35-35: LGTM!


Walkthrough

The PR updates E2E guidance to use poHomeChannel.gotoChannel(...) for known rooms and switches several Playwright test setups to that navigation path.

Changes

Known-room navigation updates

Layer / File(s) Summary
README pattern and template
apps/meteor/tests/e2e/README.md
Adds the known-room-by-URL guidance, updates the optimized serial suite template to use poHomeChannel.gotoChannel(targetChannel), and adds an anti-pattern note for /home plus navbar.openChat(name).
Embedded layout setup
apps/meteor/tests/e2e/embedded-layout.spec.ts
Replaces /home plus navbar chat opening with poHomeChannel.gotoChannel(targetChannelId) in embedded-layout test setup.
Remaining suite setup updates
apps/meteor/tests/e2e/file-upload.spec.ts, apps/meteor/tests/e2e/image-upload.spec.ts, apps/meteor/tests/e2e/quote-attachment.spec.ts, apps/meteor/tests/e2e/quote-messages.spec.ts
Updates file-upload, image-upload, quote-attachment, and quote-messages setups to navigate with poHomeChannel.gotoChannel(...) instead of the previous two-step room opening flow.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • RocketChat/Rocket.Chat#41018: Updates similar E2E navigation flow from /home plus poHomeChannel.navbar.openChat(...) to poHomeChannel.gotoChannel(...).
  • RocketChat/Rocket.Chat#41072: Also changes Meteor E2E room navigation to poHomeChannel.gotoChannel(...) in tests that need to reach a room before assertions.

Suggested labels

type: chore

Suggested reviewers

  • gabriellsh
  • juliajforesti
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main change: updating tests to use gotoChannel when possible.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@codecov

codecov Bot commented Jun 25, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 70.09%. Comparing base (660215a) to head (3cfb26e).
⚠️ Report is 2 commits behind head on develop.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##           develop   #41084      +/-   ##
===========================================
- Coverage    70.11%   70.09%   -0.03%     
===========================================
  Files         3363     3363              
  Lines       129716   129716              
  Branches     22464    22483      +19     
===========================================
- Hits         90953    90926      -27     
- Misses       35442    35474      +32     
+ Partials      3321     3316       -5     
Flag Coverage Δ
e2e 59.32% <ø> (-0.02%) ⬇️
e2e-api 46.27% <ø> (-0.88%) ⬇️
unit 70.00% <ø> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@sampaiodiego sampaiodiego marked this pull request as ready for review June 25, 2026 22:24
@sampaiodiego sampaiodiego requested a review from a team as a code owner June 25, 2026 22:24

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 6 files

Re-trigger cubic

@sampaiodiego sampaiodiego added this to the 8.7.0 milestone Jun 25, 2026
@sampaiodiego sampaiodiego added the stat: QA assured Means it has been tested and approved by a company insider label Jun 25, 2026
@dionisio-bot dionisio-bot Bot removed the stat: QA assured Means it has been tested and approved by a company insider label Jun 25, 2026
@sampaiodiego sampaiodiego added the stat: QA assured Means it has been tested and approved by a company insider label Jun 25, 2026
@dionisio-bot dionisio-bot Bot added the stat: ready to merge PR tested and approved waiting for merge label Jun 25, 2026
@dionisio-bot dionisio-bot Bot added this pull request to the merge queue Jun 26, 2026
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Jun 26, 2026
@dionisio-bot dionisio-bot Bot added this pull request to the merge queue Jun 29, 2026
Merged via the queue into develop with commit eed19bc Jun 29, 2026
83 of 85 checks passed
@dionisio-bot dionisio-bot Bot deleted the test-quote-attachment-flaky branch June 29, 2026 07:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

stat: QA assured Means it has been tested and approved by a company insider stat: ready to merge PR tested and approved waiting for merge type: chore

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants